<?php
require_once('../class/config.php');
require_once(SITE_PATH . '/class/DB/db_config.php');
$queue = new Queue($dataBase);

echo '<pre>';

switch ($_GET['RK']) {
    case 'T2RK1':
        if ($_GET['share']) {
            echo 'T2RK1: load profile shared';
            $networkOwnerId = SERVICE_NO_ID;
            $electricitySupplierId = 'T2ES1';
            $balanceProviderId = null;
            $profileSettlementAreaId = '12';
            $calculationStage = 'final';
            $supplyMonth = date('Y-m-d H:i:s');
            $highLoadProfileShare = 123.45;
            $lowLoadProfileShare = 54.321;
            $loadProfileShare = new Client_RK1_receiveLoadProfileShare($networkOwnerId, $electricitySupplierId, $balanceProviderId, $profileSettlementAreaId, $calculationStage, $supplyMonth, $highLoadProfileShare, $lowLoadProfileShare);
            $queue->add('Client_RK1', 'sendLoadProfileShare', $loadProfileShare);
        } else {
            echo 'T2RK1: load profile';
            $networkOwnerId = SERVICE_NO_ID;
            $date = date('Y-m-d H:i:s');
            $hour = date('Y-m-d H:i:s');
            $hourlyLoad = '100.0';
            $loadProfile = new Client_RK1_receiveLoadProfile($networkOwnerId, $date, $hour, $hourlyLoad);
            $queue->add('Client_RK1', 'sendLoadProfile', $loadProfile);
        }
    break;
    case 'T2RK2':
        if ($_GET['share']) {
            echo 'T2RK2: load profile shared';
            $networkOwnerID = SERVICE_NO_ID;
            $electricitySupplierID = 'T2ES1';
            $balanceProviderID = null;
            $profileSettlementAreaID = '12';
            $calculationStage = 'final';
            $supplyMonth = date('Y-m-d H:i:s');
            $highLoadValue = 123.45;
            $lowLoadValue = 54.321;
            $loadProfileShare = new Client_RK2_saveLoadProfileShare($networkOwnerID, $electricitySupplierID, $balanceProviderID, $profileSettlementAreaID, $calculationStage, $supplyMonth, $highLoadValue, $lowLoadValue);
            $queue->add('Client_RK2', 'sendLoadProfileShare', $loadProfileShare);
        } else {
            echo 'T2RK2: load profile';
            $date = date('Y-m-d H:i:s');
            $hour = date('Y-m-d H:i:s');
            $hourlyValue = '123';
            $networkOwnerID = SERVICE_NO_ID;
            $loadProfile = new Client_RK2_saveLoadProfile($date, $hour, $hourlyValue, $networkOwnerID);
            $queue->add('Client_RK2', 'sendLoadProfile', $loadProfile);
        }
    break;
}


echo "\n";
echo 'Done: ' . date('H:i:s');

echo '</pre>';